import matplotlib.pyplot as plt

clock_offset = []

with open('PPSCtlOut.dat') as f1:
    while True:
        line = f1.readline()
        if not line:
            break
        val = float(line.split()[2])
        clock_offset.append(val)

n = len(clock_offset)
clock_offset_diff = []
for i in range(10, n-10):
    clock_offset_diff.append(clock_offset[i]-clock_offset[i-1])


# 
clock_offset2 = []
with open('PPSCtlOut2.dat') as f2:
    while True:
        line = f2.readline()
        if not line:
            break
        val = float(line.split()[1])
        clock_offset2.append(val)

n = len(clock_offset2)
clock_offset_diff2 = []
for i in range(10, n-10):
    clock_offset_diff2.append(clock_offset2[i]-clock_offset2[i-1])
plt.figure(1)
plt.plot(clock_offset_diff)
plt.figure(2)
plt.plot(clock_offset_diff2)
plt.show()

